import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: WHY
 * Date: 2023-03-22
 * Time: 21:53
 */
public class ThreadDemo1 {
    public static   int flag=0;
    public static void main(String[] args) {

        Thread t1=new Thread(()->{
            while(flag==0){

            }
            System.out.println("线程结束");
        });
        t1.start();


        Thread t2=new Thread(()->{
            Scanner scanner=new Scanner(System.in);
            System.out.println("请输入一个数");
            flag=scanner.nextInt();
        });
        t2.start();


    }
}
